Fix: EWW_NET wrong values for TX/RX stats #1108
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The sysinfo crate, structure Networks, basically caches one value of total_received/total_transmitted each (as well as other metrics) and returns the difference between those two values when queried via the
received()
andtransmitted()
functions.These values are updated by both the
refresh()
andrefresh_list()
functions; so by calling both of them right after each other like previously done here, sets both the cached total_received/... and the current total_received/... to nearly the same value.refresh_list()
also updates the list of interfaces on a host, with a marginally small performance impact for doing so (I measured slightly more than 100 microseconds on my machine (0.1 milliseconds), around 20-25% more than withrefresh()
), especially considering this is run only every 2 seconds.Fixes #1070
Usage
N/A
Showcase
N/A
Additional Notes
I tested by running my panel config, which includes a network widget showing these two values. What was displayed was comparable to the network stats in bottom/btm.
Checklist
Please make sure you can check all the boxes that apply to this PR.
docs/content/main
directory has been adjusted to reflect my changes.cargo fmt
to automatically format all code before committing